<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>购物车推荐商品</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.servletContext.contextPath}/st/back/css/base.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.servletContext.contextPath}/st/back/css/iconfont.css">
    <script type="text/javascript" src="${pageContext.servletContext.contextPath}/st/front/JS/jquery-3.2.1.min.js"></script>
    <link rel="stylesheet" type="text/css" href="${pageContext.servletContext.contextPath}/st/back/layui/css/layui.css">
    <script type="text/javascript" src="${pageContext.servletContext.contextPath}/st/back/layui/layui.js"></script>

    <style>
        .layui-table img {
            max-width: none;
        }
    </style>

</head>

<body>
<div class="cBody">
    <table class="layui-table">
        <thead>
        <tr>
            <th>商品名称</th>
            <th>商品图片</th>
            <th>商品价格</th>
            <th>商品库存</th>
            <th>商品类型</th>
            <th>商品配置</th>
            <th>商品销量</th>
            <th>是否下架</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${describes}" var="comm">
            <tr>
                <td>${comm.comname}</td>
                <td>
                    <img src="${pageContext.servletContext.contextPath}/images/${comm.picture}" width="20" height="20" onmouseenter="imgBig(this)" onmouseleave="imgSmall(this)"/>
                </td>
                <td>${comm.depraice}</td>
                <td>${comm.count}</td>
                <td>${comm.pbname}</td>
                <td>${comm.config}</td>
                <td>${comm.sale}</td>
                <td><a href="${pageContext.servletContext.contextPath}/shelf/${comm.cid}">下架</a></td>
                <td>
                    <button class="layui-btn layui-btn-xs" onclick="updateBut(${comm.deid})">修改库存</button><br>
                    <c:if test="${result==10}">
                        <a class="layui-btn layui-btn-xs" href="${pageContext.servletContext.contextPath}/addcart?add=0&deid=${comm.deid}">取消购物车推荐</a>
                    </c:if>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>

    <script>

        //修改按钮
        var updateFrame = null;

        function updateBut(deid) {
            layui.use('layer', function () {
                var layer = layui.layer;

                //iframe层-父子操作
                updateFrame = layer.open({
                    title: "商品信息修改",
                    type: 2,
                    area: ['70%', '60%'],
                    scrollbar: false,	//默认：true,默认允许浏览器滚动，如果设定scrollbar: false，则屏蔽
                    maxmin: true,
                    content: '${pageContext.servletContext.contextPath}/getDeid/'+deid
                });
            });

        }
    </script>
</div>
</body>

</html>